from django.db import models


# 分类表
class NewsCategory(models.Model):
    name = models.CharField(max_length=64)
    desc = models.CharField(max_length=255)
    c_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'news_category'


# 新闻表
class NewsNew(models.Model):
    title = models.CharField(max_length=64)
    url = models.CharField(max_length=64)
    new_time = models.CharField(max_length=32)
    excel_dir = models.FileField(upload_to='excle_files/', max_length=255, blank=True, null=True)
    categroy = models.ForeignKey('NewsCategory', models.DO_NOTHING, blank=True, null=True)

    class Meta:
        db_table = 'news'
